﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SharingCenter.Web.Shared
{
    using SharingCenter.Web.Classes;
    using SharingCenter.Web.Classes.enums;
    using SharingCenter.Web.Classes.Comments;
    using System.Web.Security;
    using SharingCenter.Web.Classes.Accounts;

    public class CommentCreatedEventArgs : EventArgs
    {
        private Guid composerUserId;
        private string commentContent;
        private DateTime commentDate;

        
        public string CommentContent { get { return commentContent; } }
        public Guid ComposerUserId { get { return composerUserId; } }
        public DateTime CommentDate { get { return commentDate; } }

        public CommentCreatedEventArgs(Guid uid, string content)
        {
            composerUserId = uid;
            commentContent = content;
            commentDate = DateTime.Now;
        }
    }

    public partial class CommentControl : SharedUserControl
    {
        public string AppName { get; set; }
        public string ContextName { get; set; }

        public bool AllowDelete
        {
            set { try { ViewState[this.UniqueID + "_ALLOW_DELETE"] = value; } catch { ViewState[this.UniqueID + "_ALLOW_DELETE"] = false; } }
            get { try { return (bool)ViewState[this.UniqueID + "_ALLOW_DELETE"]; } catch { return false; } }
        }

        /// <summary>
        /// Deprecated, use AllowDelete instead.
        /// </summary>
        public Guid? ManagerUserId
        {
            set { try { ViewState["MGR_UID"] = value; } catch { ViewState["MGR_UID"] = WebConsts.FAKE_GUID; } }
            get { try { return (Guid)ViewState["MGR_UID"]; } catch { return WebConsts.FAKE_GUID; } }
        }

        //public Unit EditorHeight { get { return Editor1.Height; } set { Editor1.Height = value; } }
        //public Unit EditorWidth { get { return Editor1.Width; } set { Editor1.Width = value; } }

        void Page_Init(object sender, EventArgs e)
        {
            //FormView1.ItemInserted += new FormViewInsertedEventHandler(FormView1_ItemInserted);
            //LinqDataSource1.Selecting += new EventHandler<LinqDataSourceSelectEventArgs>(LinqDataSource1_Selecting);
            //LinqDataSource1.Selected += new EventHandler<LinqDataSourceStatusEventArgs>(LinqDataSource1_Selected);
            //LinqDataSource1.Inserted += new EventHandler<LinqDataSourceStatusEventArgs>(LinqDataSource1_Inserted);
            //ListView1.ItemDataBound += new EventHandler<ListViewItemEventArgs>(ListView1_ItemDataBound);
        }

    }
}